package com.cn.lycss.servlet;

import com.cn.lycss.model.CompanyModel;
import com.cn.lycss.model.NavModel;
import com.cn.lycss.service.INavModelService;
import com.cn.lycss.service.impl.INavModelServiceImp;
import com.cn.lycss.service.impl.ICompanyServiceImp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/homeThree")
public class HomeThreeServlet  extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");

        ICompanyServiceImp iCompanyService=new ICompanyServiceImp();
        CompanyModel companyModel= iCompanyService.getCompanyModel();
        req.setAttribute("companyModel" ,companyModel);
/*
* ---------------------------------------导航栏------------------------------
*
* */
        INavModelService iNavModelServiceImp=new INavModelServiceImp();
       List<NavModel> companyModels=iNavModelServiceImp.getNavModel();
        req.setAttribute("navModel",companyModels);
        req.getRequestDispatcher("/jsp/home.jsp").forward(req,resp);
    }
}
